package com.qdlc.p2p.biz.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.service.RuleService;
import com.qdlc.p2p.dal.dao.RuleDao;
import com.qdlc.p2p.dal.dto.Rule;

@Service("ruleService")
public class RuleServiceImpl implements RuleService {

    @Resource
    private RuleDao ruleDao;

    @Override
    public Rule findById(Long id) {
        return ruleDao.find(id);
    }

    @Override
    public Rule findByNid(String nid) {
        return ruleDao.findObjByProperty("nid", nid);
    }

    /**
     * 根据状态获取列表
     *
     * @param status status
     * @return List
     */
    public List<Rule> list(int status) {
        return ruleDao.findByProperty("status", status);
    }

    /**
     * 查询所有的规则
     *
     * @return
     */
    public List<Rule> findAll() {
        return ruleDao.findAll();
    }

}
